Simulate a mouse click on an image. Match by sub-string match of alt text, name, or src.
#include <IE.au3>
_IEImgClick ( ByRef $o_object, $s_linkText [, $s_mode = "src" [, $i_index = 0 [, $f_wait = 1]]] )
Parameters
$o_object | Object variable of an InternetExplorer.Application, Window or Frame object |
$s_linkText | Text to match the content of the attribute specified in $s_mode |
$s_mode | Optional: specifies search mode src = (default) match the url of the image name = match the name of the image alt = match the alternate text of the image |
$i_index | Optional: If the img text occurs more than once, specify which instance you want by 0-based index |
$f_wait | Optional: specifies whether to wait for page to load before returning 0 = Return immediately, not waiting for page to load 1 = (Default) Wait for page load to complete before returning |
Return Value
Success: | Returns -1 |
Failure: | Returns 0 and sets @ERROR |
@Error: | 0 ($_IEStatus_Success) = No Error |
1 ($_IEStatus_GeneralError) = General Error | |
3 ($_IEStatus_InvalidDataType) = Invalid Data Type | |
4 ($_IEStatus_InvalidObjectType) = Invalid Object Type | |
5 ($_IEStatus_InvalidValue) = Invalid Value | |
6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout | |
7 ($_IEStatus_NoMatch) = No Match | |
8 ($_IEStatus_AccessIsDenied) = Access Is Denied | |
@Extended: | Contains invalid parameter number |
Remarks
None.
Related
_IEImgGetCollection, _IEFormImageClick
Example
; *******************************************************
; Example 1 - Click on IMG by Alt text
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
_IEImgClick ($oIE, "AutoIt Homepage Image", "alt")
; *******************************************************
; Example 2 - Click on IMG by name
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
_IEImgClick ($oIE, "AutoItImage", "name")
; *******************************************************
; Example 3 - Click on IMG by src sub-string
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
_IEImgClick ($oIE, "autoit_6_240x100.jpg", "src")
; *******************************************************
; Example 4 - Click on IMG by full src string
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
_IEImgClick ($oIE, "http://www.autoitscript.com/images/autoit_6_240x100.jpg")